/*
 * @Author: your name
 * @Date: 2021-08-08 09:52:43
 * @LastEditTime: 2021-08-11 10:16:20
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue-admin-template\src\api\departments.js
 */
import request from '@/utils/request'
/**
 * @description：获取组织架构数据
 * @returns
 */
export function getDepartments() {
  return request({
    url: '/company/department',
    method: 'GET'
  })
}

/**
 * @description 获取负责人列表
 * @returns
 */
export function getEmployeeSimple() {
  return request({
    url: '/sys/user/simple',
    method: 'GET'
  })
}

/**
 * @description 添加部门
 * @param {*} data
 */
export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}

/**
 * @description 根据ID查询部门详情
 * @param {*} id  部门ID
 */
export function getDepartDetail(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'GET'
  })
}

/**
 * @description 更新组织架构
 * @param {*} data
 */
export function updateDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'PUT',
    data
  })
}

/**
 * @description 删除部门
 * @param {*} id
 */
export function delDepartment(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}
